﻿using System;
using System.Collections.Generic;
using System.Text;
using BesAsm.MasterData.Entities;
using BesAsm.MasterData.Data;

namespace BesAsm.MasterData.Services
{
  /// <summary>
  /// Specifies an interface for NetTiers services to provide common data-getting functionality.
  /// </summary>
  /// <typeparam name="T">A NetTiers entity which implements IArcEntity</typeparam>
  public interface IArcEntityService<T> where T : IArcEntity
  {
    #region GetAll Methods
    /// <summary>
    /// Gets a row from the DataSource based on its primary key.
    /// </summary>
    /// <param name="key">The unique identifier of the row to retrieve.</param>
    /// <returns>Returns an instance of the Entity class.</returns>
    IArcEntity Get(int objectId);

    /// <summary>
    /// Gets all rows from the DataSource.
    /// </summary>
    /// <returns>Returns a TList of Entity objects.</returns>
    TList<T> GetAll();    

    /// <summary>
    /// Gets all rows from the DataSource with the provided ObjectId array.
    /// </summary>
    /// <param name="oids"></param>
    /// <returns></returns>
    TList<T> GetByOids(IEnumerable<int> oids);

    string OidField { get; }

    TList<T> GetPaged(string whereClause, string orderBy, int start, int pageLength, out int totalCount);

    #endregion
  }
}
